<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jb-aptech毕业设计项目</TITLE>
<meta name="renderer" content="ie-comp">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<script src="../script/common.js"></script>
	<script src="../script/vue.js"></script>
	<script src="../script/jquery-3.3.1.min.js"></script>
</head>
<body>

<div id="app">
	<div class="page_title">产品查询</div>
	<div class="button_bar">
		<button class="common_button" onclick="help('');">帮助</button>
		<button class="common_button" @click.prevent="load()">查询</button>
	</div>
	<table class="query_form_table">
		<tr>
			<th>名称</th>
			<td><input v-model="product.prod_name"/></td>
			<th>型号</th>
			<td><input v-model="product.prod_type"/></td>
			<th>批次</th>
			<td><input v-model="product.prod_batch"/></td>
		</tr>
	</table>
	<br />
	<table class="data_list_table">
		<tr>
			<th>编号</th>
			<th>名称</th>
			<th>型号</th>
			<th>等级/批次</th>
			<th>单位</th>
			<th>单价（元）</th>
			<th>备注</th>
		</tr>
		<tr v-for="p in products">
			<td class="list_data_number" v-text="p.prod_id">1</td>
			<td class="list_data_ltext" v-text="p.prod_name">幸福牌电视机</td>
			<td class="list_data_text" v-text="p.prod_type">818 FFT</td>
			<td class="list_data_text" v-text="p.prod_batch">2388 EA03</td>
			<td class="list_data_text" v-text="p.prod_unit">台</td>
			<td class="list_data_number" v-text="p.prod_price">7500</td>
			<td class="list_data_ltext" v-text="p.prod_memo">代生产&nbsp;</td>
		</tr>
		<tr>
			<th colspan="100" class="pager">
				<div class="pager">
					共<span v-text="pageInfo.total"></span>条记录 每页<input :value="pageInfo.pageSize" size="2" />条
					第<input :value="pageInfo.pageNum" size="2"/>页/共5页
					<a href="#">第一页</a>
					<a href="#" @click.prevent="load(pageInfo.pageNum-1)">上一页</a>
					<a href="#" @click.prevent="load(pageInfo.pageNum+1)">下一页</a>
					<a href="#">最后一页</a>
					转到<input value="1" size="2" />页
					<button width="20" onclick="reload();">GO</button>
				</div>
			</th>
		</tr>
	</table>
</div>
<script>
	const vm = new Vue({
		el:'#app',
		data:{
			products:[],
			pageInfo:{},
			product:{
				prod_id:'',
				prod_name:'',
				prod_type:'',
				prod_batch:'',
				prod_unit:'',
				prod_price:'',
				prod_memo:'',
				pageNum:1,
				pageSize:2,
			}
		},methods:{
			load(num){
				this.product.pageNum=num;
				$.getJSON("/Product/queryPage",this.product,json=>{
					this.products=json.data.pageInfo.list;
					this.pageInfo=json.data.pageInfo
				});
			}
		},mounted(){
			this.load();
		}
	})
</script>
</body>
</html>